<?php

/*------------------------------------------------
*
*   Explay Engine Content Management System.
*   Copyright © 2008 Golovdinov Alexander.
*
*-------------------------------------------------
*
*   Official site: wwww.alex-home.spb.ru/explay.html
*   Contact e-mail: golovdinov@gmail.com
*
*   GNU General Public License original source:
*   http://www.gnu.org/licenses/gpl-3.0.html
*
------------------------------------------------*/

if (!is_admin ()) exit;

include $_SERVER['DOCUMENT_ROOT'].'/themes/admin/main.php';

if (isset($_GET['delete'])) {
	$get = $db->query ("SELECT image FROM ".DB_PEREFIX."_admin_cp WHERE id = ".intval ($_GET['delete']));
	if ($db->num_rows($get) == 1)  {
		$db->query ("DELETE FROM ".DB_PEREFIX."_admin_cp WHERE id = ".intval ($_GET['delete']));
		$it = $db->fetch_array ($get);
		if (file_exists ($_SERVER['DOCUMENT_ROOT'].'/'.$it['image']) && $it['image'] != 'images/admin/default.gif') unlink ($_SERVER['DOCUMENT_ROOT'].'/'.$it['image']);
	}
}

$mod_list = '';
$sys_list = '';
$ut_list = '';

$get = $db->query ("SELECT * FROM ".DB_PEREFIX."_admin_cp ORDER BY id");

while (list ($id, $group, $href, $name, $image) = $db->fetch_row ($get)) {
	
	$item = admincp_item ($id, $href, $name, $image);
	
	if ($group == 'modules')
		$mod_list .= $item;
	elseif ($group == 'system')
		$sys_list .= $item;
	else
		$ut_list .= $item;
	
}

past_table ('Контент', $mod_list);
past_table ('Система', $sys_list);
past_table ('Утилиты', $ut_list);
